package com.itxiuyixiu.tools.security.ddos;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author 黄磊
 * @date 2020/2/7
 */
public class MonitoringWebConfig implements WebMvcConfigurer {

    private final IpHandlerInterceptor ipHandlerInterceptor;

    public MonitoringWebConfig(IpHandlerInterceptor ipHandlerInterceptor) {
        this.ipHandlerInterceptor = ipHandlerInterceptor;
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(ipHandlerInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/public/js/**", "/public/css/**", "public/image/**");
    }
}
